import { KeyValue, Page, Role } from '@/model';
import axiosHttp from '@/libs/request';
import Book from '@/model/book/book';

/**
 * 新建
 * @param data
 */
const createBook = (data: Book) => {
  return axiosHttp.post<void>('/admin/book/create', data);
};

/**
 * 分页
 * @param data 分页对象，检索条件
 */
const pageBook = (data: Page<Book>) => {
  return axiosHttp.post<Page<Book>>('/admin/book/page', data);
};

/**
 * 更新
 * @param data
 */
const updateBook = (data: Book) => {
  return axiosHttp.post<void>('/admin/book/update', data);
};

/**
 * 删除
 * @param id
 */
const deleteBook = (id: string) => {
  return axiosHttp.delete<void>('/admin/book/delete', { id });
};

export { createBook, updateBook, pageBook, deleteBook };
